#pragma once
#include "Data.h"
class CData;

class CPathData :  public CData
{
public:
    CPathData(void);
    virtual ~CPathData(void);

        // load data from spreadsheet to here
    virtual void load(const vector<CSpreadsheet*> &vSpreadsheet_ );
    // save changes into spreadsheets
    virtual void precompute();
    virtual void precomputeEachTrial();
    virtual bool trialFinished();
    virtual void clear();
    virtual void saveToFile();
    virtual void afterCompute();
    virtual bool preRunFinished();
    virtual void parser(const string& strCondition_, vector<int>* pvConds_ );

    //Helper
    void precomputePathDirect();
    //virtual void computeEyePositionAndGazing(CMatrix<double>& mEye_,CMatrix<double>& mGazingPoint_,int nCurrentFrame_)=0;
    //retriever
    //posts
    const double& postRadius()   const {return _dPostRadius;}
          double& setPostRadius()    {return _dPostRadius;}
    const double& postHeight() const {return _dTargetHeight;}
          double& setPostHeight()    {return _dTargetHeight;}
    const    int& postNum()   const {return _nPostNum;}
             int& setPostNum()      {return _nPostNum;}
    const double& postRemoval() const {return _dPostRemoval;}
          double& setPostRemoval()    {return _dPostRemoval;}

    //textured ground
    const double& groundX() const {return _dGroundX;}
          double& setGroundX()     {return _dGroundX;}
    const double& groundZ()     const {return _dGroundZ;}
          double& setGroundZ()     {return _dGroundZ;}
    
    //path
          //normalized vector indicating gaze
    const CMatrix<double>&    observerDirect()        const    {return _mObserveDirect;}
          CMatrix<double>&    setObserverDirect()              {return _mObserveDirect;}    
    const CMatrix<double>&    eyePath()            const    {return _mEyePath;}
          CMatrix<double>&    setEyePath()                  {return _mEyePath;}
    const CMatrix<double>& textureColor() const {return _mTextureColor;}
          CMatrix<double>& setTextureColor()    {return _mTextureColor;}
    //dot ground, cloud, perspective and deperspective
    const int& numSquares() const {return _nNumSquare;}
          int& setNumSquares()    {return _nNumSquare;}  
    const int& cloudy3DDotNum() const {return _nCloudy3DDotTotalNum;}
          int& setCloudy3DDotNum()    {return _nCloudy3DDotTotalNum;}
    const int& dotSize() const {return _nDotSize;}
          int& setDotSize() {return _nDotSize;}
    const CMatrix<double>& dotColor() const {return _mDotColor;}
          CMatrix<double>& setDotColor()    {return _mDotColor;}
       //rotaion
    const	CMatrix<double>&	    Roll()      		        const	{return _mRoll;}
            CMatrix<double>&	    SetRoll()                           {return _mRoll;}
    const	CMatrix<double>&	    Yaw()      		            const	{return _mYaw;}
            CMatrix<double>&	    SetYaw()                            {return _mYaw;}
    const	CMatrix<double>&	    Pitch()      		        const	{return _mPitch;}
            CMatrix<double>&	    SetPitch()                          {return _mPitch;}
    const	CMatrix<double>&	    ObserverUpVec()		        const	{return _mObserverUpVec;}
            CMatrix<double>&	    SetObserverUpVec()                  {return _mObserverUpVec;}
    const	CMatrix<double>&	    ObserverUpVecRef()		    const	{return _mObserverUpVecRef;}
            CMatrix<double>&	    SetObserverUpVecRef()               {return _mObserverUpVecRef;}    
 
protected:
    double              _dPostRadius;
    double              _dPostRemoval;
    int                 _nPostNum;
    double              _dDoorHeight;
    double              _dDoorWidth;
    double              _dWallDistance;
    double              _dGroundX;
    double              _dGroundZ;
    double              _dTargetRadius;
    double              _dTargetHeight;
    double              _dInfrontofFar;
    double              _dGazePerturbationAxisOffset;
    CMatrix<double>      _mDotColor; 
    int                 _nDotSize;
    CMatrix<double>     _mEyePath;
    CMatrix<double>     _mObserveDirect;
    CMatrix<double>     _mObserverUpVec;
    CMatrix<double>     _mObserverUpVecRef;
    CMatrix<double>     _mRoll;
    CMatrix<double>     _mYaw;
    CMatrix<double>     _mPitch;
    CMatrix<double>     _mTextureColor;
private:
    double _dTFOVx_2;
    double _dNearTriangleArea;
    int _nNumSquare;
    int _nCloudy3DDotTotalNum;
    CMatrixR    _mRotationNG;
    CMatrixR    _mRotationNT;
    CMatrixR    _mRotationOT;
};
